import {
  BookOutlined,
  CalendarOutlined,
  SnippetsOutlined,
  UserOutlined,
} from "@ant-design/icons";
import { MenuProps } from "antd";

/**
 * 显示Nav的页面
 */
export const showNavPagesArr = [
  "/",
  "/Course",
  "/Manage",
  "/PersonalPost",
  "/PersonalCenter",
  "/PersonalCourse",
  "/PublishPost",
  "/PostContentView",
  "/PublishCourse",
  "/PersonalCourse/MyAudit",
  "/PersonalCourse/MyApply",
  "/VedioContentView",
];
/**
 * 管理页面导航栏
 */
type MenuItem = Required<MenuProps>["items"][number];

export const manageNavItems: MenuItem[] = [
  {
    key: "userManage",
    label: "用戶管理",
    icon: <UserOutlined />,
  },
  {
    key: "postManage",
    label: "编程讨论管理",
    icon: <SnippetsOutlined />,
  },
  {
    key: "courseManage",
    label: "编程课程管理",
    icon: <BookOutlined />,
  },
  {
    key: "typesManage",
    label: "技术类别管理",
    icon: <CalendarOutlined />,
  },
];
/**
 * 服务器域名
 */
export const SEVER_URL = "http://47.109.41.236:8888/";
/**
 * 课程状态配置项
 */
export const COURSE_STATUS = [
  { value: 0, label: "待审核" },
  { value: 1, label: "上架" },
  { value: 2, label: "下架" },
  { value: 3, label: "审核未通过" },
];

/**
 * 课程申请配置项
 */
export const COURSE_APPLY = [
  { value: 0, label: "是" },
  { value: 1, label: "否" },
];
/**
 * 帖子审核状态
 */
export const POST_STATUS = (value: number) => {
  switch (value) {
    case 0:
      return "待审核";
    case 1:
      return "通过";
    case 2:
      return "未通过";
  }
};
/**
 * 课程审核状态
 */
export const VEDIO_STATUS = (value: number) => {
  switch (value) {
    case 0:
      return "待审核";
    case 1:
      return "通过";
    case 2:
      return "未通过";
  }
};
/**
 * 我的课程Menu
 */

export const MENU_ITEMS = [
  {
    title: "我的编程课程",
    value: "PersonalCourse",
  },
  {
    title: "我的申请",
    value: "MyApply",
  },
  {
    title: "我的审核",
    value: "MyAudit",
  },
];
// 富文本编辑器配置
export const modules = {
  toolbar: [
    [{ header: [1, 2, 3, false] }],
    ["bold", "italic", "underline", "strike"],
    ["blockquote", "code-block"],
    [{ list: "ordered" }, { list: "bullet" }],
    ["link", "image", "video"], // 默认图片按钮
    ["clean"],
  ],
};
export const formats = [
  "header",
  "bold",
  "italic",
  "underline",
  "strike",
  "blockquote",
  "code-block",
  "list",
  "bullet",
  "link",
  "image",
  "video",
];
/**
 * 课程状态
 */
export const getCourseObj = (value: number) => {
  switch (value) {
    case 0:
      return {
        status: "default",
        text: "待审核",
      };
    case 1:
      return {
        status: "success",
        text: "上架",
      };
    case 2:
      return {
        status: "warning",
        text: "下架",
      };
    case 3:
      return {
        status: "error",
        text: "未通过",
      };
    default:
      return { status: "default", text: "待审核" };
  }
};
export const getCourseContentObj = (value: number) => {
  switch (value) {
    case 1:
      return {
        status: "success",
        text: "通过",
      };
    case 2:
      return {
        status: "error",
        text: "未通过",
      };
    default:
      return { status: "default", text: "待审核" };
  }
};
